package client.gui.workbox;

import stalker.Stalker;
import client.network.ServiceRequestCenter;
import data.Data;

public class WorkBox {
  
  private final WorkBoxController view_and_controller_;
  private final WorkBoxModel model_;
  private final String username_;
  
  public WorkBox(String username, ServiceRequestCenter servicer) {
    assert (username != null && servicer != null);
    username_ = username;
    model_ = new WorkBoxModel(servicer);
    view_and_controller_ = new WorkBoxController(username, servicer, model_);
    model_.setActiveSession(0);
  }
  
  public boolean isVisible() {
    return view_and_controller_.isVisible();
  }
  
  public void setVisible(boolean status) {
    view_and_controller_.setVisible(status);
  }
  
  public String getUsername() {
    return username_;
  }
  
  public void receiveData(Stalker sender, Data data) {
    assert (sender != null && data != null);
    model_.receiveData(sender, data);
  }
  
  public void receiveInvitation(Stalker inviter, Stalker location) {
    assert (inviter != null && location != null);
    model_.receiveInvitation(inviter, location);
  }
  
}
